test: add comprehensive unit tests for model types#490
test: add comprehensive unit tests for model types#490ByteBaker wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
Add 112+ non-async unit tests across model modules to increase coverage: - content.rs: 34 tests for RawContent variants, type discrimination, meta preservation - prompt.rs: 24 tests for Prompt, PromptArgument, role handling, meta behavior - resource.rs: 21 tests for Resource, ResourceTemplate, URI schemes, equality - tool.rs: 33 tests for Tool, ToolAnnotations, schema handling, default behaviors
|
I appreciate the contribution to improve testing! Thank you I think we should reconsider some of them however. The value of a test is how many bugs it catches over its lifetime minus the number of times you have to change it when making routine code changes. Asserting for the existence of properties that are set on a default instance of a class like this: feels like it will require us to make many test changes when we change models, but not necessarily catch bugs. What do you think about a revision where we keep only the tests you've added here which rely on some processing internal to the model, and not just asserting on the existence of certain keys etc? |
|
Going to close this out for now, but feel free to post thoughts in response to my last message in Nov and re-open with a new viewpoint on the tests if you like! |
Add 112+ non-async unit tests across model modules to increase coverage:
Motivation and Context
Better coverage.
How Has This Been Tested?
Yes. All unit tests pass.
Breaking Changes
None.
Types of changes
Checklist
Additional context